# -*- coding: utf-8 -*-
# @Time : 2025/2/24 17:23
# @Author : debbyszhang
# @File : gateway_list.py
# @desc :
import allure

from pageObject.cross_gateway_list_page import CrossGatewayListPage


@allure.feature("跨链网关列表")
class TestGatewayList:

    def test_gateway_list(self, page):
        cross_gateway_page = CrossGatewayListPage(page)
        list_data = cross_gateway_page.gateway_list()

        # 打印获取的数据
        for row in list_data:
            print(row)
        # gateway_name = cross_gateway_page.get_gateway_list_data('网关名称', 1)
        # print(gateway_name)
        # gateway_type = cross_gateway_page.gateway_list('网关类型', 1)
        # print(gateway_type)
        # create_time = cross_gateway_page.gateway_list('创建时间', 1)
        # print(create_time)
        # ip = cross_gateway_page.gateway_list('IP地址信息', 1)
        # print(ip)
        # gateway_status = cross_gateway_page.gateway_list('网关状态', 1)
        # print(gateway_status)
        # gateway_name = cross_gateway_page.gateway_list('授权申请状态', 1)
        # print(gateway_name)
        # apply_status = cross_gateway_page.gateway_list('操作', 1)
        # print(apply_status)
        # headers = page.locator("table thead tr th")
        # headers_text = [header.text_content() for header in headers.all()]
        # print("表头:", headers_text)
        #
        # rows = page.locator("table tbody tr")
        # if rows.count() == 0:
        #     print("列表中没有数据")
        #
        # # 获取第一行数据
        # first_row = rows.nth(0)
        # cells = first_row.locator("td")
        # cells_text = [cell.text_content() for cell in cells.all()]
        # print("第一行数据:", cells_text)
        #
        # # 提取网关名称
        # gateway_name_index = headers_text.index("网关名称")
        # gateway_name = cells_text[gateway_name_index]
        # print("第一个数据的网关名称:", gateway_name)
        # # ---------------------
        # # 获取第二行数据
        # first_row = rows.nth(1)
        # cells = first_row.locator("td")
        # cells_text = [cell.text_content() for cell in cells.all()]
        # print("第二行数据:", cells_text)
        #
        # # 提取网关名称
        # gateway_name_index = headers_text.index("网关名称")
        # gateway_name = cells_text[gateway_name_index]
        # print("第二个数据的网关名称:", gateway_name)
